#EXTRA_CFLAGS += -DCONFIG_IEEE80211_NOWEP=y
#EXTRA_CFLAGS += -DCONFIG_RTL8180_IOMAP
EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/wireless
EXTRA_CFLAGS += -std=gnu89
EXTRA_CFLAGS += -O2
CC            = gcc
EXTRA_CFLAGS += -DTHOMAS_TURBO
#CFLAGS += -DCONFIG_RTL8185B
#CFLAGS += -DCONFIG_RTL818x_S

#added for EeePC testing
EXTRA_CFLAGS += -DENABLE_IPS
EXTRA_CFLAGS += -DSW_ANTE
EXTRA_CFLAGS += -DTX_TRACK
EXTRA_CFLAGS += -DHIGH_POWER
EXTRA_CFLAGS += -DSW_DIG
EXTRA_CFLAGS += -DRATE_ADAPT
EXTRA_CFLAGS += -DCONFIG_RTL8180_PM

#+YJ,080626
#EXTRA_CFLAGS += -DENABLE_DOT11D

#enable it for legacy power save, disable it for leisure  power save
EXTRA_CFLAGS += -DENABLE_LPS  


#EXTRA_CFLAGS += -mhard-float -DCONFIG_FORCE_HARD_FLOAT=y

#ieee80211-r8180-objs := ieee80211.o ieee80211_rx.o ieee80211_tx.o ieee80211_wx.o ieee80211_module.o

#ieee80211_crypt-r8180 := ieee80211_crypt-r8180.o

r8180-objs := r8180_core.o r8180_93cx6.o r8180_wx.o r8180_rtl8225z2.o r8185b_init.o r8180_dm.o r8180_pm.o

#ieee80211_crpt_wep-r8180-objs := ieee80211_crypt_wep-r8180.o

obj-m += r8180.o
#obj-m +=ieee80211-r8180.o
#obj-m +=ieee80211_crypt-r8180.o
#obj-m +=ieee80211_crypt_wep-r8180.o

MODULES_LST := r8180.ko 
#ieee80211-r8180.ko ieee80211-r8180_crypt.ko
#MODULES_ALG_LST := ieee80211_crypt_wep-r8180.ko

KVER  := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=

all: modules

clean:
	rm -f *.mod.c *.mod *.o .*.cmd *.ko 
	rm -f Module.symvers modules.order
	rm -rf $(PWD)/.tmp_version
modules:
#	$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) MODVERDIR=$(PWD) modules
	$(MAKE) -C $(KSRC) M=$(PWD) CC=$(CC) modules

MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless
#MOD_ALGDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/alg

install: modules
	mkdir -p $(MODDESTDIR)
#	mkdir -p $(MOD_ALGDESTDIR)
	install -p -m 644 $(MODULES_LST) $(MODDESTDIR)
#	install -p -m 644 $(MODULES_ALG_LST) $(MOD_ALGDESTDIR)

uninstall:
	cd $(MODDESTDIR) && rm $(MODULES_LST)
#	cd $(MOD_ALGDESTDIR) && rm $(MODULES_ALG_LST)

load:
	./module_load
       
unload: 

	./module_unload
